package 迭代器模式;

import java.util.Iterator;

/**
 * @program: leetcode
 * @description:
 * @author: HuRan QQ1345122890
 * @create: 2021-11-06 18:35
 */
public class Main {
    public static void main(String[] args) {
        BookShelf bookShelf=new BookShelf(4);
        bookShelf.appendBook(new Book("s"));
        bookShelf.appendBook(new Book("22"));
        bookShelf.appendBook(new Book("222"));
        bookShelf.appendBook(new Book("s2222"));
        final Iterator iterator = bookShelf.iterator();
        while (iterator.hasNext()){
            final Book next = (Book)iterator.next();
            System.out.println(next);
        }

    }
}